// JavaScript Document

$(document).ready(function () { 


	var id = $('#district_wise').val();	
	if (id) {
		get_district_annoucements(id);
	}
	var cate_id = $('#cate_wise').val();	
	if (cate_id) {
		get_category_annoucements(cate_id);
	}
});


function GoSub(str) {	
	window.location.href= str;
	}
function get_district_announcements(disst=0) {	

		//alert(disst);
//Get the language from url and pass from php file
			var lang = jQuery('html').attr('lang');	 //alert(lang);
			
			var lang_url = 'ta/'
			if(lang == 'en')
			lang_url = '';
			
	var district_id= disst;
	
	$('#announce_content').html('Loading the Records....');
	
	$.ajax({
		type: "GET",
		url: "",
		data: 'q='+lang_url+'announcements/district_wise&dist=' + encodeURI(district_id),
		success: function(msg) { //alert(msg);
			$('#announce_content').html('');
			$('#announce_content').html(msg);
			$('#announce_content').blur();
			return;
		}
		
   });
}
function get_category_annoucements(category) {	
//Get the language from url and pass from php file
				var lang = jQuery('html').attr('lang');	
			
			var lang_url = 'ta/'
			if(lang == 'en')
			lang_url = '';
			
	var cate_id= category;
	//alert(cate_id);
	$('#announce_content').html('Loading the Records....');
	
	$.ajax({
		type: "GET",
		url: "",
		data: 'q='+'announcements/cate_wise&category=' + encodeURI(cate_id),
		success: function(msg) { //alert(msg);
			//$('#announce_content').html('');
			$('#announce_content').html(msg);
			//$('#category_wise').blur();
			return;
		}
		
   });
}